# Contributor: Raed Rizqie <raed.rizqie@gmail.com>

_realname=nbclassic
pkgbase=mingw-w64-python-jupyter-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-python-jupyter-${_realname}
pkgver=1.2.0
pkgrel=1
pkgdesc='Jupyter Notebook as a Jupyter Server extension (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: jupyter-nbclassic'
  'purl: pkg:pypi/nbclassic'
)
msys2_repository_url='https://github.com/jupyter/nbclassic'
url='https://nbclassic.readthedocs.io/'
license=('spdx:BSD-3-Clause')
depends=(
    "${MINGW_PACKAGE_PREFIX}-python"
    "${MINGW_PACKAGE_PREFIX}-python-argon2_cffi"
    "${MINGW_PACKAGE_PREFIX}-python-ipykernel"
    "${MINGW_PACKAGE_PREFIX}-python-ipython_genutils"
    "${MINGW_PACKAGE_PREFIX}-python-jinja"
    "${MINGW_PACKAGE_PREFIX}-python-jupyter-nbconvert"
    "${MINGW_PACKAGE_PREFIX}-python-jupyter-nbformat"
    "${MINGW_PACKAGE_PREFIX}-python-jupyter_client"
    "${MINGW_PACKAGE_PREFIX}-python-jupyter_core"
    "${MINGW_PACKAGE_PREFIX}-python-jupyter_notebook_shim"
    "${MINGW_PACKAGE_PREFIX}-python-jupyter_server"
    "${MINGW_PACKAGE_PREFIX}-python-nest-asyncio"
    "${MINGW_PACKAGE_PREFIX}-python-prometheus-client"
    "${MINGW_PACKAGE_PREFIX}-python-pyzmq"
    "${MINGW_PACKAGE_PREFIX}-python-send2trash"
    "${MINGW_PACKAGE_PREFIX}-python-terminado"
    "${MINGW_PACKAGE_PREFIX}-python-tornado"
    "${MINGW_PACKAGE_PREFIX}-python-traitlets")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-jupyter-packaging"
             "${MINGW_PACKAGE_PREFIX}-python-babel")
options=('!strip')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('736ec50483a54485971db213be9207e34e51fc144c78343625b69917423644ba')

build() {
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
